package com.lagou.rocket.demo.order.controller;


import com.lagou.rocket.demo.order.model.Result;
import com.lagou.rocket.demo.order.service.IOrderService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *
 * </p>
 *
 * @author KK
 * @since 2021-10-30
 */
@RestController
public class OrderController {


    private final IOrderService orderService;

    public OrderController(IOrderService orderService) {
        this.orderService = orderService;
    }


    @RequestMapping("/order")
    public Result order(
            @RequestParam("id") Long id

    ) {
        return Result.ok(orderService.getOrderStatus(id));
    }


    @RequestMapping("/pay")
    public Result pay(
            @RequestParam("userId") Long userId,
            @RequestParam("id") Long id
    ) {

        String pay = orderService.pay(userId, id);
        return Result.ok(pay);
    }





}
